package ArithmeticObjects;

/**
 * Representing a Ring, indicating relevant arithmetic objects' order 
 * @author Idan
 */
public class Ring {
	protected LargeNumberObject order;
	
	/**
	 * creates a Ring from an LargeNumberObject representing its order
	 * @param order a LargeNumberObject representing the Ring's order
	 * @throws Exception in case the order was not given as a LargeNumberObject
	 */
	public Ring(LargeNumberObject order) throws Exception{
		int certainty = (int)Math.pow(10,6);
		if (!order.getValue().isProbablePrime(certainty))
			throw new Exception("Ring order must be prime!");
		this.order = new LargeNumberObject(order.getValue());
	}
	
	/**
	 * @return the Ring's order
	 */
	public Element getOrder() {
		return order;
	}
}
